<template>
  <div class="fabu-container">
    <van-form @submit="onSubmit" v-if="user">
      <van-field
        v-model="textTitle"
        label="文章标题"
        placeholder="请输入文章内容"
      />
      <van-field
        readonly
        clickable
        name="picker"
        :value="textFenlei"
        label="文章分类"
        placeholder="请选择文章分类"
        @click="showPicker = true"
      />
      <van-popup v-model="showPicker" position="bottom">
        <van-picker
          show-toolbar
          :columns="columns"
          @confirm="onConfirm"
          @cancel="showPicker = false"
        />
      </van-popup>
      <van-field
        readonly
        clickable
        name="picker"
        :value="textFenlei"
        label="文章标签"
        placeholder="请选择文章标签"
        @click="showPicker = true"
      />
      <van-popup v-model="showPicker" position="bottom">
        <van-picker
          show-toolbar
          :columns="columns"
          @confirm="onConfirm"
          @cancel="showPicker = false"
        />
      </van-popup>
      <van-field name="uploader" label="文件上传">
        <template #input>
          <van-uploader v-model="uploader" />
        </template>
      </van-field>
      <van-field
        v-model="message"
        rows="2"
        autosize
        label="文章正文"
        type="textarea"
        maxlength="50"
        placeholder="请输入正文内容"
        show-word-limit
      />
      <div class="vanButton">
        <van-button icon="plus" type="primary">发布</van-button>
        <van-button icon="send-gift-o" type="info">存草稿</van-button>
        <van-button icon="revoke" type="danger">重置</van-button>
      </div>
    </van-form>
    <van-empty description="登录之后才可以发表哦" v-else />
  </div>
</template>

<script>
export default {
  name: "FaBuIndex",
  components: {},
  props: {},
  data() {
    return {
      user: true, // 登录状态
      textTitle: "", //文章标题
      textFenlei: "", //文章分类
      textBiaoqian: "", //文章标签
      columns: [
        "分类1",
        "分类2",
        "分类3",
        "分类4",
        "分类5",
        
      ],
      showPicker: false,
      uploader: [{ url: "https://img01.yzcdn.cn/vant/cat.jpeg" }], // 文件上传
      message: "",
    };
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    onConfirm(value) {
      this.textFenlei = value;
      this.showPicker = false;
    },
    onSubmit() {},
  },
};
</script>
<style lang="less" scoped>
.fabu-container {
  .vanButton {
    padding-top: 50px;
    display: flex;
    justify-content: space-around;
    align-content: center;
  }
}
</style>
